//
//  YZMDayMonthHeaderView.m
//  YZMicroStock
//
//  Created by apple on 17/4/1.
//  Copyright © 2017年 cqjr. All rights reserved.
//

#import "YZMDayMonthHeaderView.h"

@interface YZMDayMonthHeaderView ()
@property(nonatomic, strong) UILabel *rankLabel;
@property(nonatomic, strong) UILabel *nameLabel;
@property(nonatomic, strong) UILabel *numberLabel;

@end

@implementation YZMDayMonthHeaderView

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createObject];
    }
    return self;
}

-(void)createObject{
    
    self.contentView.backgroundColor=[YZMAppStyle colorForMain];

    UIView *topView = [UIView new];
    [self addSubview:topView];
    topView.backgroundColor = [YZMAppStyle appBackgroundColor];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.right.equalTo(self);
        make.height.mas_equalTo(14);
    }];
    
    self.rankLabel=[YZMAppStyle labelWithMediumWhite];
    _rankLabel.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_rankLabel];
    [_rankLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(16);
        make.width.mas_offset(ScreenWidth*0.25);
    }];
    
    
    self.nameLabel=[YZMAppStyle labelWithMediumWhite];
    _nameLabel.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.top.equalTo(_rankLabel);
        make.width.mas_offset(ScreenWidth*0.35);
        make.left.equalTo(_rankLabel.mas_right);
    }];
    
    self.numberLabel=[YZMAppStyle labelWithMediumWhite];
    _numberLabel.textAlignment=NSTextAlignmentRight;
    [self addSubview:_numberLabel];
    [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_rankLabel);
        make.width.mas_offset(ScreenWidth*0.33);
        make.right.equalTo(self).offset(-ScreenWidth*0.07);
    }];
    
    UIView *bottomLine = [YZMAppStyle splitLine];
    [self addSubview:bottomLine];
    [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self);
        make.left.equalTo(self).offset(15);
        make.right.equalTo(self).offset(-15);
    }];
    
    if (iPhone4 || iPhone5) {
        self.nameLabel.font = [YZMAppStyle fontWithSize:11];
        self.numberLabel.font = [YZMAppStyle fontWithSize:11];
    }
    
}

-(void)setHeadStyle:(HEADSTYLE)headStyle{
    
    _headStyle = headStyle;
    if (self.headStyle == HEADSTYLE_DAYGAIN ) {
        
        _rankLabel.text=@"排名";
        _nameLabel.text=@"用户";
        _numberLabel.text=@"盈利(元)";
    }else{
        
        _rankLabel.text=@"排名";
        _nameLabel.text=@"用户";
        _numberLabel.text=@"总收入(元)";
    }
}

@end
